#[doc = "Register `RF_TEMP_MODE` reader"]
pub struct R(crate::R<RF_TEMP_MODE_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<RF_TEMP_MODE_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<RF_TEMP_MODE_SPEC>> for R {
    fn from(reader: crate::R<RF_TEMP_MODE_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `RF_TEMP_MODE` writer"]
pub struct W(crate::W<RF_TEMP_MODE_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<RF_TEMP_MODE_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<RF_TEMP_MODE_SPEC>> for W {
    fn from(writer: crate::W<RF_TEMP_MODE_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Hardware report source select.\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RF_OVER_TEMP_PRT_HW_SRC_A {
    #[doc = "0: TSensor inside the RF module reports temperature protection alarm."]
    RF_TSENSOR = 0,
    #[doc = "1: TSensor reports the temperature protection alarm."]
    TSENSOR = 1,
}
impl From<RF_OVER_TEMP_PRT_HW_SRC_A> for bool {
    #[inline(always)]
    fn from(variant: RF_OVER_TEMP_PRT_HW_SRC_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `rf_over_temp_prt_hw_src` reader - Hardware report source select."]
pub struct RF_OVER_TEMP_PRT_HW_SRC_R(crate::FieldReader<bool, RF_OVER_TEMP_PRT_HW_SRC_A>);
impl RF_OVER_TEMP_PRT_HW_SRC_R {
    pub(crate) fn new(bits: bool) -> Self {
        RF_OVER_TEMP_PRT_HW_SRC_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RF_OVER_TEMP_PRT_HW_SRC_A {
        match self.bits {
            false => RF_OVER_TEMP_PRT_HW_SRC_A::RF_TSENSOR,
            true => RF_OVER_TEMP_PRT_HW_SRC_A::TSENSOR,
        }
    }
    #[doc = "Checks if the value of the field is `RF_TSENSOR`"]
    #[inline(always)]
    pub fn is_rf_tsensor(&self) -> bool {
        **self == RF_OVER_TEMP_PRT_HW_SRC_A::RF_TSENSOR
    }
    #[doc = "Checks if the value of the field is `TSENSOR`"]
    #[inline(always)]
    pub fn is_tsensor(&self) -> bool {
        **self == RF_OVER_TEMP_PRT_HW_SRC_A::TSENSOR
    }
}
impl core::ops::Deref for RF_OVER_TEMP_PRT_HW_SRC_R {
    type Target = crate::FieldReader<bool, RF_OVER_TEMP_PRT_HW_SRC_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `rf_over_temp_prt_hw_src` writer - Hardware report source select."]
pub struct RF_OVER_TEMP_PRT_HW_SRC_W<'a> {
    w: &'a mut W,
}
impl<'a> RF_OVER_TEMP_PRT_HW_SRC_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RF_OVER_TEMP_PRT_HW_SRC_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "TSensor inside the RF module reports temperature protection alarm."]
    #[inline(always)]
    pub fn rf_tsensor(self) -> &'a mut W {
        self.variant(RF_OVER_TEMP_PRT_HW_SRC_A::RF_TSENSOR)
    }
    #[doc = "TSensor reports the temperature protection alarm."]
    #[inline(always)]
    pub fn tsensor(self) -> &'a mut W {
        self.variant(RF_OVER_TEMP_PRT_HW_SRC_A::TSENSOR)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
        self.w
    }
}
#[doc = "Polarity of the overtemperature protection signal.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RF_OVER_TEMP_PRT_POLAR_A {
    #[doc = "0: Logic signal 0 means over temperature signal is valid, 1 is invalid."]
    ZERO_VALID = 0,
    #[doc = "1: Logic signal 1 means over temperature signal is valid, 0 is invalid."]
    ONE_VALID = 1,
}
impl From<RF_OVER_TEMP_PRT_POLAR_A> for bool {
    #[inline(always)]
    fn from(variant: RF_OVER_TEMP_PRT_POLAR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `rf_over_temp_prt_polar` reader - Polarity of the overtemperature protection signal."]
pub struct RF_OVER_TEMP_PRT_POLAR_R(crate::FieldReader<bool, RF_OVER_TEMP_PRT_POLAR_A>);
impl RF_OVER_TEMP_PRT_POLAR_R {
    pub(crate) fn new(bits: bool) -> Self {
        RF_OVER_TEMP_PRT_POLAR_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RF_OVER_TEMP_PRT_POLAR_A {
        match self.bits {
            false => RF_OVER_TEMP_PRT_POLAR_A::ZERO_VALID,
            true => RF_OVER_TEMP_PRT_POLAR_A::ONE_VALID,
        }
    }
    #[doc = "Checks if the value of the field is `ZERO_VALID`"]
    #[inline(always)]
    pub fn is_zero_valid(&self) -> bool {
        **self == RF_OVER_TEMP_PRT_POLAR_A::ZERO_VALID
    }
    #[doc = "Checks if the value of the field is `ONE_VALID`"]
    #[inline(always)]
    pub fn is_one_valid(&self) -> bool {
        **self == RF_OVER_TEMP_PRT_POLAR_A::ONE_VALID
    }
}
impl core::ops::Deref for RF_OVER_TEMP_PRT_POLAR_R {
    type Target = crate::FieldReader<bool, RF_OVER_TEMP_PRT_POLAR_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `rf_over_temp_prt_polar` writer - Polarity of the overtemperature protection signal."]
pub struct RF_OVER_TEMP_PRT_POLAR_W<'a> {
    w: &'a mut W,
}
impl<'a> RF_OVER_TEMP_PRT_POLAR_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RF_OVER_TEMP_PRT_POLAR_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "Logic signal 0 means over temperature signal is valid, 1 is invalid."]
    #[inline(always)]
    pub fn zero_valid(self) -> &'a mut W {
        self.variant(RF_OVER_TEMP_PRT_POLAR_A::ZERO_VALID)
    }
    #[doc = "Logic signal 1 means over temperature signal is valid, 0 is invalid."]
    #[inline(always)]
    pub fn one_valid(self) -> &'a mut W {
        self.variant(RF_OVER_TEMP_PRT_POLAR_A::ONE_VALID)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
        self.w
    }
}
#[doc = "Overtemperature protection signal select.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RF_OVER_TEMP_PRT_SEL_A {
    #[doc = "0: hardware control."]
    HARDWARE = 0,
    #[doc = "1: manual control."]
    MANUAL = 1,
}
impl From<RF_OVER_TEMP_PRT_SEL_A> for bool {
    #[inline(always)]
    fn from(variant: RF_OVER_TEMP_PRT_SEL_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `rf_over_temp_prt_sel` reader - Overtemperature protection signal select."]
pub struct RF_OVER_TEMP_PRT_SEL_R(crate::FieldReader<bool, RF_OVER_TEMP_PRT_SEL_A>);
impl RF_OVER_TEMP_PRT_SEL_R {
    pub(crate) fn new(bits: bool) -> Self {
        RF_OVER_TEMP_PRT_SEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RF_OVER_TEMP_PRT_SEL_A {
        match self.bits {
            false => RF_OVER_TEMP_PRT_SEL_A::HARDWARE,
            true => RF_OVER_TEMP_PRT_SEL_A::MANUAL,
        }
    }
    #[doc = "Checks if the value of the field is `HARDWARE`"]
    #[inline(always)]
    pub fn is_hardware(&self) -> bool {
        **self == RF_OVER_TEMP_PRT_SEL_A::HARDWARE
    }
    #[doc = "Checks if the value of the field is `MANUAL`"]
    #[inline(always)]
    pub fn is_manual(&self) -> bool {
        **self == RF_OVER_TEMP_PRT_SEL_A::MANUAL
    }
}
impl core::ops::Deref for RF_OVER_TEMP_PRT_SEL_R {
    type Target = crate::FieldReader<bool, RF_OVER_TEMP_PRT_SEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `rf_over_temp_prt_sel` writer - Overtemperature protection signal select."]
pub struct RF_OVER_TEMP_PRT_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> RF_OVER_TEMP_PRT_SEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RF_OVER_TEMP_PRT_SEL_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "hardware control."]
    #[inline(always)]
    pub fn hardware(self) -> &'a mut W {
        self.variant(RF_OVER_TEMP_PRT_SEL_A::HARDWARE)
    }
    #[doc = "manual control."]
    #[inline(always)]
    pub fn manual(self) -> &'a mut W {
        self.variant(RF_OVER_TEMP_PRT_SEL_A::MANUAL)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
        self.w
    }
}
#[doc = "Overtemperature protection manual control signal.\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RF_OVER_TEMP_PRT_MAN_A {
    #[doc = "0: valid."]
    VALID = 0,
    #[doc = "1: invalid."]
    INVALID = 1,
}
impl From<RF_OVER_TEMP_PRT_MAN_A> for bool {
    #[inline(always)]
    fn from(variant: RF_OVER_TEMP_PRT_MAN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `rf_over_temp_prt_man` reader - Overtemperature protection manual control signal."]
pub struct RF_OVER_TEMP_PRT_MAN_R(crate::FieldReader<bool, RF_OVER_TEMP_PRT_MAN_A>);
impl RF_OVER_TEMP_PRT_MAN_R {
    pub(crate) fn new(bits: bool) -> Self {
        RF_OVER_TEMP_PRT_MAN_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RF_OVER_TEMP_PRT_MAN_A {
        match self.bits {
            false => RF_OVER_TEMP_PRT_MAN_A::VALID,
            true => RF_OVER_TEMP_PRT_MAN_A::INVALID,
        }
    }
    #[doc = "Checks if the value of the field is `VALID`"]
    #[inline(always)]
    pub fn is_valid(&self) -> bool {
        **self == RF_OVER_TEMP_PRT_MAN_A::VALID
    }
    #[doc = "Checks if the value of the field is `INVALID`"]
    #[inline(always)]
    pub fn is_invalid(&self) -> bool {
        **self == RF_OVER_TEMP_PRT_MAN_A::INVALID
    }
}
impl core::ops::Deref for RF_OVER_TEMP_PRT_MAN_R {
    type Target = crate::FieldReader<bool, RF_OVER_TEMP_PRT_MAN_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `rf_over_temp_prt_man` writer - Overtemperature protection manual control signal."]
pub struct RF_OVER_TEMP_PRT_MAN_W<'a> {
    w: &'a mut W,
}
impl<'a> RF_OVER_TEMP_PRT_MAN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RF_OVER_TEMP_PRT_MAN_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "valid."]
    #[inline(always)]
    pub fn valid(self) -> &'a mut W {
        self.variant(RF_OVER_TEMP_PRT_MAN_A::VALID)
    }
    #[doc = "invalid."]
    #[inline(always)]
    pub fn invalid(self) -> &'a mut W {
        self.variant(RF_OVER_TEMP_PRT_MAN_A::INVALID)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
        self.w
    }
}
impl R {
    #[doc = "Bit 6 - Hardware report source select."]
    #[inline(always)]
    pub fn rf_over_temp_prt_hw_src(&self) -> RF_OVER_TEMP_PRT_HW_SRC_R {
        RF_OVER_TEMP_PRT_HW_SRC_R::new(((self.bits >> 6) & 0x01) != 0)
    }
    #[doc = "Bit 4 - Polarity of the overtemperature protection signal."]
    #[inline(always)]
    pub fn rf_over_temp_prt_polar(&self) -> RF_OVER_TEMP_PRT_POLAR_R {
        RF_OVER_TEMP_PRT_POLAR_R::new(((self.bits >> 4) & 0x01) != 0)
    }
    #[doc = "Bit 3 - Overtemperature protection signal select."]
    #[inline(always)]
    pub fn rf_over_temp_prt_sel(&self) -> RF_OVER_TEMP_PRT_SEL_R {
        RF_OVER_TEMP_PRT_SEL_R::new(((self.bits >> 3) & 0x01) != 0)
    }
    #[doc = "Bit 2 - Overtemperature protection manual control signal."]
    #[inline(always)]
    pub fn rf_over_temp_prt_man(&self) -> RF_OVER_TEMP_PRT_MAN_R {
        RF_OVER_TEMP_PRT_MAN_R::new(((self.bits >> 2) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bit 6 - Hardware report source select."]
    #[inline(always)]
    pub fn rf_over_temp_prt_hw_src(&mut self) -> RF_OVER_TEMP_PRT_HW_SRC_W {
        RF_OVER_TEMP_PRT_HW_SRC_W { w: self }
    }
    #[doc = "Bit 4 - Polarity of the overtemperature protection signal."]
    #[inline(always)]
    pub fn rf_over_temp_prt_polar(&mut self) -> RF_OVER_TEMP_PRT_POLAR_W {
        RF_OVER_TEMP_PRT_POLAR_W { w: self }
    }
    #[doc = "Bit 3 - Overtemperature protection signal select."]
    #[inline(always)]
    pub fn rf_over_temp_prt_sel(&mut self) -> RF_OVER_TEMP_PRT_SEL_W {
        RF_OVER_TEMP_PRT_SEL_W { w: self }
    }
    #[doc = "Bit 2 - Overtemperature protection manual control signal."]
    #[inline(always)]
    pub fn rf_over_temp_prt_man(&mut self) -> RF_OVER_TEMP_PRT_MAN_W {
        RF_OVER_TEMP_PRT_MAN_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "RF_TEMP_MODE is the RF TEMP mode configuration register.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [rf_temp_mode](index.html) module"]
pub struct RF_TEMP_MODE_SPEC;
impl crate::RegisterSpec for RF_TEMP_MODE_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [rf_temp_mode::R](R) reader structure"]
impl crate::Readable for RF_TEMP_MODE_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [rf_temp_mode::W](W) writer structure"]
impl crate::Writable for RF_TEMP_MODE_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets RF_TEMP_MODE to value 0xff44"]
impl crate::Resettable for RF_TEMP_MODE_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0xff44
    }
}
